<script setup lang="ts">
import {linearRegression} from "@/utils/method";
import {ref} from 'vue';

const {waterForm, listB} = defineProps<{
  waterForm: Object;  // 定义采样时间的类型
  listB: Object;  // 定义采样时间的类型
}>();


// 计算 A0 的平均值
const updateA0 = () => {
  const num1 = parseFloat(waterForm.qxhzdatas.xgd_1) || 0;
  const num2 = parseFloat(waterForm.qxhzdatas.xgd_2) || 0;
  if (waterForm.qxhzdatas.xgd_1 !== "" && waterForm.qxhzdatas.xgd_2 !== "") {
    waterForm.qxhzdatas.a0_1 = ((num1 + num2) / 2).toFixed(3); // 保留两位小数
  } else {
    waterForm.qxhzdatas.a0_1 = "";
  }
};

const calculateA0 = (index) => {
  const a0_1 = parseFloat(waterForm.qxhzdatas.a0_1);
  const xgdValue = parseFloat(waterForm.qxhzdatas[`xgd_${index}`]);

  if (!isNaN(a0_1) && !isNaN(xgdValue)) {
    waterForm.qxhzdatas[`a0_${index - 1}`] = (xgdValue - a0_1).toFixed(3);
  } else {
    waterForm.qxhzdatas[`a0_${index - 1}`] = "";
  }
  updateYValues()
};

// 使用 ref() 创建数组，确保修改时 Vue 能监听变化
const xValues = ref(Array(9).fill(null)); // 存 Lg（x）
const yValues = ref(Array(9).fill(null)); // 存 毫伏值（y）


const pushToArray = (index, keyPrefix) => {
  if (index === 1) return;

  let val = waterForm.qxhzdatas[`${keyPrefix}${index}`];

  // 过滤掉 `/` 或者非数值字符，避免影响计算
  if (!val || val.includes("/") || isNaN(parseFloat(val))) {
    return;
  }

  val = parseFloat(val);

  if (keyPrefix === "bzwzhl_") {
    xValues.value[index - 1] = val; // 存入 Lg(x)
  }

  updateCalibrationCurve(); // 重新计算校准曲线
};


// 计算校准曲线（线性回归）
const updateCalibrationCurve = () => {
  const validX = xValues.value.filter(v => v !== null);
  const validY = yValues.value.filter(v => v !== null);

  if (validX.length >= 2 && validY.length >= 2 && validX.length === validY.length) {
    const result = linearRegression(validX, validY);

    // 处理 intercept 符号
    const interceptSign = result.intercept >= 0 ? ` + ${result.intercept}` : ` ${result.intercept}`;

    waterForm.qxhzdatas.y = `${result.slope}x${interceptSign}`;
    waterForm.js_formula = `${result.slope}x${interceptSign}`;
    waterForm.qxhzdatas.r = result.correlation;
  } else {
    waterForm.qxhzdatas.y = "";
    waterForm.qxhzdatas.r = "";
  }
};

const updateYValues = () => {

  yValues.value = [0]; // 先清空 yValues，确保数据更新

  for (let i = 2; i <= 9; i++) {
    const a0Value = parseFloat(waterForm.qxhzdatas[`a0_${i}`]);

    if (!isNaN(a0Value)) {
      yValues.value[i - 1] = a0Value; // 存入 yValues，索引从 0 开始
    }
  }

  updateCalibrationCurve(); // 重新计算校准曲线
};


// 曲线
const handleQxChange = (item) => {
  // 根据选中的样品编号，找到对应的 finalResult
  const selectedOption = listB.qxyList.find(
      option => option.sampleNumber === item.ypbh
  );

  // 如果找到了对应的选项，则将 finalResult 赋值给 px_phz
  if (selectedOption) {
    item.cdjg = selectedOption.finalResult;
  }
}
// 空白
const handleKbyChange = (item) => {
  // 根据选中的样品编号，找到对应的 finalResult
  const selectedOption = listB.kbyList.find(
      option => option.sampleNumber === item.kb_ypbh
  );

  // 如果找到了对应的选项，则将 finalResult 赋值给 px_phz
  if (selectedOption) {
    item.kb_xgd = selectedOption.hfz;
  }
}

// 标准
const handleBzyChange = (item) => {
  // 根据选中的样品编号，找到对应的 finalResult
  const selectedOption = listB.bzyList.find(
      option => option.extractedContent === item.bz_ypph
  );

  console.log(selectedOption)

  // 如果找到了对应的选项，则将 finalResult 赋值给 px_phz
  if (selectedOption) {
    item.bz_cdnd = selectedOption.finalResult;
  }
}


// 加标
const handleJzyChange = (item) => {
  // 根据选中的样品编号，找到对应的 finalResult
  const selectedOption = listB.jbyList.find(
      option => option.sampleNumber === item.jb_ypbh
  );

  // 如果找到了对应的选项，则将 finalResult 赋值给 px_phz
  if (selectedOption) {
    item.jb_bynd = selectedOption.finalResult;
  }
}


const handlePxyChange = (selectKey) => {
  // 获取对应的样品编号
  const selectedSampleNumber = waterForm.pxycd_fx[selectKey];

  // 在 pxyList 中查找匹配的样品
  const selectedSample = listB.pxyList.find(
      sample => sample.sampleNumber === selectedSampleNumber
  );

  // 填充浓度信息到相应的字段
  if (selectKey === 'bt_1') {
    waterForm.pxycd_fx.cdnd_1 = selectedSample.finalResult;
  } else if (selectKey === 'bt_2') {
    waterForm.pxycd_fx.cdnd_2 = selectedSample.finalResult;
  } else if (selectKey === 'bt_3') {
    waterForm.pxycd_fx.cdnd_3 = selectedSample.finalResult;
  } else if (selectKey === 'bt_4') {
    waterForm.pxycd_fx.cdnd_4 = selectedSample.finalResult;
  } else if (selectKey === 'bt_5') {
    waterForm.pxycd_fx.cdnd_5 = selectedSample.finalResult;
  } else if (selectKey === 'bt_6') {
    waterForm.pxycd_fx.cdnd_6 = selectedSample.finalResult;
  }
}

</script>

<template>
  <el-card class="box-card">
    <div style="text-align: center;display: flex;align-items: center;justify-content: space-between">
      <div></div>
      <h1> 水质 分光光度法分析原始记录(一)(B面)</h1>
      <div></div>
    </div>
    <div>SXLPHJ/JL/CX-22-54</div>
    <table class="table">
      <tr>
        <td colspan="10" style="text-align: center">
          <div style="display: flex;align-items: center;justify-content: space-between">
            <div></div>
            <span style="font-size: 18px">标准曲线绘制</span>
            <div style="display: flex;align-items: center;">
              <span style="width: 140px;">绘制日期：</span>
              <el-input style="border: 1px solid #ccc;border-radius: 6px" placeholder="请输入"
                        v-model="waterForm.hzrq"></el-input>
            </div>
          </div>
        </td>
      </tr>
      <tr style="background-color: #f2f2f2">
        <td>标准贮备液批号</td>
        <td colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.bzzbyph"/>
        </td>
        <td colspan="2">
          <div style="display:flex;align-items: center;">
            贮备液浓度(
            <el-input placeholder="请输入" style="width: 20%;" v-model="waterForm.unit.bz_zbynd"></el-input>
            )
          </div>
        </td>
        <td colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.zbynd"/>
        </td>
        <td>贮备液有校日期</td>
        <td colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.zbyyxrq"/>
        </td>
      </tr>
      <tr>
        <td>
          <div style="display:flex;align-items: center;justify-content: center;">
            标准中间液浓度(
            <el-input placeholder="请输入" style="width: 20%;" v-model="waterForm.unit.bz_bzzjynd"></el-input>
            )
          </div>
        </td>
        <td colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.bzszjynd"/>
        </td>
        <td colspan="2">移取标准贮备体积(mL)</td>
        <td colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.yqbzzbytj"/>
        </td>
        <td>定容体积(mL)</td>
        <td colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.drtj1"/>
        </td>
      </tr>
      <tr style="background-color: #f2f2f2">
        <td>
          <div style="display:flex;align-items: center;justify-content: center;">
            标准使用液浓度(
            <el-input placeholder="请输入" style="width: 20%;" v-model="waterForm.unit.bz_bzsyynd"></el-input>
            )
          </div>
        </td>
        <td colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.bzsyynd"/>
        </td>
        <td colspan="2">移取标准中间液体积(mL)</td>
        <td colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.yqbzzjytj"/>
        </td>
        <td>定容体积(mL)</td>
        <td colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.drtj2"/>
        </td>
      </tr>
      <tr>
        <td>编号</td>
        <td>01</td>
        <td>02</td>
        <td>1</td>
        <td>2</td>
        <td>3</td>
        <td>4</td>
        <td>5</td>
        <td>6</td>
        <td>7</td>
      </tr>
      <tr>
        <td>标准使用液体积（mL）</td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.qxhzdatas.bzsyytj_1"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.qxhzdatas.bzsyytj_2"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.qxhzdatas.bzsyytj_3"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.qxhzdatas.bzsyytj_4"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.qxhzdatas.bzsyytj_5"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.qxhzdatas.bzsyytj_6"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.qxhzdatas.bzsyytj_7"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.qxhzdatas.bzsyytj_8"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.qxhzdatas.bzsyytj_9"/>
        </td>
      </tr>
      <tr>
        <td>
          <div style="display:flex;align-items: center;justify-content: center;">
            标准物质含量/浓度（
            <el-input placeholder="请输入" v-model="waterForm.unit.bzwznd"></el-input>
            ）
          </div>
        </td>
        <td v-for="index in 9" :key="index">
          <el-input
              style="width: 100%; border: 1px solid transparent"
              placeholder="请输入"
              v-model="waterForm.qxhzdatas[`bzwzhl_${index}`]"
              @input="pushToArray(index, 'bzwzhl_')"
          />
        </td>
      </tr>
      <tr>
        <td>吸光度A</td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入" @input="updateA0"
                    v-model="waterForm.qxhzdatas.xgd_1"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入" @input="updateA0"
                    v-model="waterForm.qxhzdatas.xgd_2"/>
        </td>
        <td v-for="index in 7" :key="index">
          <el-input
              style="width: 100%; border: 1px solid transparent"
              placeholder="请输入"
              v-model="waterForm.qxhzdatas[`xgd_${index + 2}`]"
              @blur="calculateA0(index + 2)"
          />
        </td>
      </tr>
      <tr>
        <td>A-A0</td>
        <td colspan="2">
          <div style="display: flex;align-items: center">
            A0=
            <el-input
                style="width: 100%; border: 1px solid transparent"
                placeholder="请输入"
                v-model="waterForm.qxhzdatas.a0_1"
            />
          </div>

        </td>
        <td v-for="index in 7" :key="index">
          <el-input
              style="width: 100%; border: 1px solid transparent"
              placeholder="请输入"
              v-model="waterForm.qxhzdatas[`a0_${index + 1}`]"
              @input="pushToArray(index, 'a0_')"
          />
        </td>
      </tr>
      <tr>
        <td>校准曲线</td>
        <td colspan="6">
          <div style="display: flex;align-items: center;">
            y=
            <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                      v-model="waterForm.qxhzdatas.y"/>
            r=
            <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                      v-model="waterForm.qxhzdatas.r"/>
          </div>
        </td>
        <td>定容体积(mL)</td>
        <td colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.qxhzdatas.drtj3"/>
        </td>
      </tr>
      <tr>
        <td colspan="10" style="text-align: center">曲线校核点测定</td>
      </tr>
      <tr>
        <td style="text-align: center" colspan="2">样品编号</td>
        <td colspan="2" style="text-align: center">
          <div style="display:flex;align-items: center;justify-content: center;">
            测定结果（
            <el-input placeholder="请输入" style="width: 20%;" v-model="waterForm.unit.qx_cdjg"></el-input>
            ）
          </div>
        </td>
        <td style="text-align: center" colspan="2">
          <div style="display:flex;align-items: center;justify-content: center;">
            相对（
            <el-input placeholder="请输入" style="width: 20%;" v-model="waterForm.unit.qx_xd"></el-input>
            ）（%）
          </div>
        </td>
        <td colspan="2" style="text-align: center">质控要求</td>
        <td colspan="2" style="text-align: center">是否合格</td>
      </tr>
      <tr v-for="(item,index) in waterForm.qxjhdcd" :key="index">
        <td style="text-align: center" colspan="2">
          <el-select v-model="item.ypbh" placeholder="请选择" style="width: 100%; border: 1px solid transparent"
                     filterable
                     allow-create
                     default-first-option
                     @change="handleQxChange(item)">
            <el-option
                v-for="(option, index) in listB.qxyList"
                :key="index"
                :label="option.sampleNumber"
                :value="option.sampleNumber">
            </el-option>
          </el-select>
        </td>
        <td colspan="2" style="text-align: center">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.cdjg"/>
        </td>
        <td style="text-align: center" colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.xd"/>
        </td>
        <td colspan="2" style="text-align: center">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.zkyq"/>
        </td>
        <td colspan="2" style="text-align: center">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.sfhg"/>
        </td>
      </tr>
      <tr>
        <td colspan="10" style="text-align: center">空白检查</td>
      </tr>
      <tr>
        <td style="text-align: center" colspan="2">样品编号</td>
        <td style="text-align: center" colspan="2">吸光度(A)</td>
        <td colspan="2" style="text-align: center">
          <div style="display:flex;align-items: center;justify-content: center;">
            样品浓度（
            <el-input placeholder="请输入" style="width: 20%;" v-model="waterForm.unit.kb_ypnd"></el-input>
            ）
          </div>
        </td>
        <td style="text-align: center" colspan="2">质控要求</td>
        <td colspan="2" style="text-align: center">是否合格</td>
      </tr>
      <tr v-for="(item,index) in waterForm.kbycd" :key="index">
        <td style="text-align: center" colspan="2">
          <el-select v-model="item.kb_ypbh" placeholder="请选择" style="width: 100%; border: 1px solid transparent"
                     filterable
                     allow-create
                     default-first-option
                     @change="handleKbyChange(item)">
            <el-option
                v-for="(option, index) in listB.kbyList"
                :key="index"
                :label="option.sampleNumber"
                :value="option.sampleNumber">
            </el-option>
          </el-select>
        </td>
        <td colspan="2" style="text-align: center">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.kb_xgd"/>
        </td>
        <td colspan="2" style="text-align: center">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.kb_ypnd"/>
        </td>
        <td colspan="2" style="text-align: center">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.kb_zkyq"/>
        </td>
        <td colspan="2" style="text-align: center">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.kb_sfhg"/>
        </td>
      </tr>
      <tr>
        <td colspan="10" style="text-align: center">平行样测定</td>
      </tr>
      <tr>
        <td colspan="2">平行样编号</td>
        <td colspan="3">
          <div style="display: flex;align-items: center;width: 100%;">
            <div style="display: flex;align-items: center;width: 50%;">
              (
              <el-select v-model="waterForm.pxycd_fx.bt_1" placeholder="请选择"
                         filterable
                         allow-create
                         default-first-option
                         style="width: 100%; border: 1px solid transparent"
                         @change="handlePxyChange('bt_1')">
                <el-option
                    v-for="(option, index) in listB.pxyList"
                    :key="index"
                    :label="option.sampleNumber"
                    :value="option.sampleNumber">
                </el-option>
              </el-select>
              )
            </div>
            与
            <div style="display: flex;align-items: center;width: 50%;">
              (
              <el-select v-model="waterForm.pxycd_fx.bt_2" placeholder="请选择"
                         filterable
                         allow-create
                         default-first-option
                         style="width: 100%; border: 1px solid transparent"
                         @change="handlePxyChange('bt_2')">
                <el-option
                    v-for="(option, index) in listB.pxyList"
                    :key="index"
                    :label="option.sampleNumber"
                    :value="option.sampleNumber">
                </el-option>
              </el-select>
              )
            </div>
          </div>
        </td>
        <td colspan="3">
          <div style="display: flex;align-items: center">
            <div style="display: flex;align-items: center;width: 50%;">
              (
              <el-select v-model="waterForm.pxycd_fx.bt_3" placeholder="请选择"
                         filterable
                         allow-create
                         default-first-option
                         style="width: 100%; border: 1px solid transparent"
                         @change="handlePxyChange('bt_3')">
                <el-option
                    v-for="(option, index) in listB.pxyList"
                    :key="index"
                    :label="option.sampleNumber"
                    :value="option.sampleNumber">
                </el-option>
              </el-select>
              )
            </div>
            与
            <div style="display: flex;align-items: center;width: 50%;">
              (
              <el-select v-model="waterForm.pxycd_fx.bt_4" placeholder="请选择"
                         filterable
                         allow-create
                         default-first-option
                         style="width: 100%; border: 1px solid transparent"
                         @change="handlePxyChange('bt_4')">
                <el-option
                    v-for="(option, index) in listB.pxyList"
                    :key="index"
                    :label="option.sampleNumber"
                    :value="option.sampleNumber">
                </el-option>
              </el-select>
              )
            </div>
          </div>
        </td>
        <td colspan="2">
          <div style="display: flex;align-items: center">
            <div style="display: flex;align-items: center;width: 50%;">
              (
              <el-select v-model="waterForm.pxycd_fx.bt_5" placeholder="请选择"
                         filterable
                         allow-create
                         default-first-option
                         style="width: 100%; border: 1px solid transparent"
                         @change="handlePxyChange('bt_5')">
                <el-option
                    v-for="(option, index) in listB.pxyList"
                    :key="index"
                    :label="option.sampleNumber"
                    :value="option.sampleNumber">
                </el-option>
              </el-select>
              )
            </div>
            与
            <div style="display: flex;align-items: center;width: 50%;">
              (
              <el-select v-model="waterForm.pxycd_fx.bt_6" placeholder="请选择"
                         filterable
                         allow-create
                         default-first-option
                         style="width: 100%; border: 1px solid transparent"
                         @change="handlePxyChange('bt_6')">
                <el-option
                    v-for="(option, index) in listB.pxyList"
                    :key="index"
                    :label="option.sampleNumber"
                    :value="option.sampleNumber">
                </el-option>
              </el-select>
              )
            </div>
          </div>
        </td>
      </tr>
      <tr>
        <td colspan="2">
          <div style="display:flex;align-items: center;justify-content: center;">
            测定浓度（
            <el-input placeholder="请输入" style="width: 20%;" v-model="waterForm.unit.px_cdnd"></el-input>
            ）
          </div>
        </td>
        <td colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.pxycd_fx.cdnd_1"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.pxycd_fx.cdnd_2"/>
        </td>
        <td colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.pxycd_fx.cdnd_3"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.pxycd_fx.cdnd_4"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.pxycd_fx.cdnd_5"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.pxycd_fx.cdnd_6"/>
        </td>
      </tr>
      <tr>
        <td colspan="2">
          <el-radio-group v-model="waterForm.pxycd_fx.xdpc_1">
            <el-radio value="1">相对偏差</el-radio>
            <el-radio value="2">自定义</el-radio>
          </el-radio-group>
        </td>
        <td colspan="3">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.pxycd_fx.xdpc_2"/>
        </td>
        <td colspan="3">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.pxycd_fx.xdpc_3"/>
        </td>
        <td colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.pxycd_fx.xdpc_4"/>
        </td>
      </tr>
      <tr>
        <td colspan="2">质控要求</td>
        <td colspan="3">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.pxycd_fx.zkyq_1"/>
        </td>
        <td colspan="3">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.pxycd_fx.zkyq_2"/>
        </td>
        <td colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.pxycd_fx.zkyq_3"/>
        </td>
      </tr>
      <tr>
        <td colspan="2">是否合格</td>
        <td colspan="3">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.pxycd_fx.sfhg_1"/>
        </td>
        <td colspan="3">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.pxycd_fx.sfhg_2"/>
        </td>
        <td colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.pxycd_fx.sfhg_3"/>
        </td>
      </tr>
      <tr>
        <td colspan="10" style="text-align: center">标准样品测定</td>
      </tr>
      <tr>
        <td colspan="2">样品批号</td>
        <td colspan="3">
          <div style="display:flex;align-items: center;justify-content: center;">
            测定浓度（
            <el-input placeholder="请输入" style="width: 20%;" v-model="waterForm.unit.bz_cdnd"></el-input>
            ）
          </div>
        </td>
        <td colspan="3">
          <div style="display:flex;align-items: center;justify-content: center;">
            标准值（
            <el-input placeholder="请输入" style="width: 20%;" v-model="waterForm.unit.bz_bzz"></el-input>
            ）
          </div>
        </td>
        <td colspan="2">是否合格</td>
      </tr>
      <tr v-for="(item,index) in waterForm.bzycd" :key="index">
        <td colspan="2">
          <el-select v-model="item.bz_ypph" placeholder="请选择"
                     filterable
                     allow-create
                     default-first-option
                     style="width: 100%; border: 1px solid transparent"
                     @change="handleBzyChange(item)">
            <el-option
                v-for="(option, index) in listB.bzyList"
                :key="index"
                :label="option.extractedContent"
                :value="option.extractedContent">
            </el-option>
          </el-select>
        </td>
        <td colspan="3">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.bz_cdnd"/>
        </td>
        <td colspan="3">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.bz_bzz"/>
        </td>
        <td colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.bz_sfhg"/>
        </td>
      </tr>
      <tr>
        <td colspan="10" style="text-align: center">加标回收样测定</td>
      </tr>
      <tr>
        <td colspan="2">样品编号</td>
        <td>
          <div style="display:flex;align-items: center;justify-content: center;">
            标态浓度（
            <el-input placeholder="请输入" style="width: 20%;" v-model="waterForm.unit.jb_btnd"></el-input>
            ）
          </div>
        </td>
        <td>
          <div style="display:flex;align-items: center;justify-content: center;">
            加标量（
            <el-input placeholder="请输入" style="width: 20%;" v-model="waterForm.unit.jb_jbl"></el-input>
            ）
          </div>
        </td>
        <td colspan="2">
          <div style="display:flex;align-items: center;justify-content: center;">
            加标后样品含量/浓度（
            <el-input placeholder="请输入" style="width: 20%;" v-model="waterForm.unit.jb_ypnd"></el-input>
            ）
          </div>
        </td>
        <td>
          <div style="display:flex;align-items: center;justify-content: center;">
            原样品含量/浓度（
            <el-input placeholder="请输入" style="width: 20%;" v-model="waterForm.unit.jb_yyphl"></el-input>
            ）
          </div>
        </td>
        <td>回收率（%）</td>
        <td>质控要求</td>
        <td>是否合格</td>
      </tr>
      <tr v-for="(item,index) in waterForm.jbycd" :key="index">
        <td colspan="2">
          <el-select v-model="item.jb_ypbh" placeholder="请选择"
                     filterable
                     allow-create
                     default-first-option
                     style="width: 100%; border: 1px solid transparent"
                     @change="handleJzyChange(item)">
            <el-option
                v-for="(option, index) in listB.jbyList"
                :key="index"
                :label="option.sampleNumber"
                :value="option.sampleNumber">
            </el-option>
          </el-select>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.jb_bynd"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.jb_jbl"/>
        </td>
        <td colspan="2">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.jb_jbhyphl"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.jb_yypgl"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.jb_hsl"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.jb_zkyq"/>
        </td>
        <td>
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="item.jb_sfhg"/>
        </td>
      </tr>
      <tr>
        <td>备注</td>
        <td colspan="9">
          <el-input style="width: 100%;border: 1px solid transparent" placeholder="请输入"
                    v-model="waterForm.bnotes"/>
        </td>
      </tr>
    </table>
  </el-card>
</template>

<style scoped lang="scss">

.table {
  width: 100%;
  border-collapse: collapse; /* 表格边框合并 */
  text-align: left; /* 默认左对齐 */
  font-size: 14px; /* 字体大小 */
  color: #606266; /* 默认字体颜色 */
  margin-bottom: 20px;
}

.table th,
.table td {
  border: 1px solid #c2bfbf; /* 表格单元格边框颜色 */
  padding: 10px; /* 单元格内边距 */
}

.table th {
  background: #f5f7fa; /* 表头背景色 */
  font-weight: 600; /* 表头字体加粗 */
  color: #303133; /* 表头字体颜色 */
  text-align: center; /* 表头居中 */
}

.table-td {
  display: flex;
}

::v-deep .el-input__wrapper {
  background-color: transparent;
  box-shadow: none;
}

::v-deep .el-select__wrapper {
  background-color: transparent;
  box-shadow: none;
}

::v-deep .el-input-group__append {
  background-color: transparent;
  box-shadow: none;
}
</style>
